@pexip/hooks
Type Aliases
AutoHideUIInterfacesState
Ƭ AutoHideUIInterfacesState: "visible" | "hidden"
Variables
UI_INACTIVITY_TIMEOUT
• Const UI_INACTIVITY_TIMEOUT: 5000
autoHideUIInterfacesStateSignal
• Const autoHideUIInterfacesStateSignal: Signal<AutoHideUIInterfacesState>
fullscreenSignal
• Const fullscreenSignal: Signal<boolean>
Functions
isFullscreen
▸ isFullscreen(fullscreenElement): boolean
a boolean that indicates whether the document is in full-screen mode.
Parameters
| Name | Type |
|---|---|
fullscreenElement | null | Element |
Returns
boolean
useAnimationFrame
▸ useAnimationFrame(callback, shouldStop?): void
Parameters
| Name | Type | Default value |
|---|---|---|
callback | FrameRequestCallback | undefined |
shouldStop | boolean | false |
Returns
void
useAutoHideUIInterfaces
▸ useAutoHideUIInterfaces(isStreamReady, isDisabledByConfig, shouldDisplay?): Object
Hook to signal display state (show/hide) based on UI inactivity timeout
Parameters
| Name | Type | Description |
|---|---|---|
isStreamReady | boolean | only apply autoHide if we've got a ready stream |
isDisabledByConfig | boolean | if true then auto hiding is disabled, UI controls will not be hidden |
shouldDisplay? | (shouldDisplay: boolean) => void | callback to signal when to hide and when to show |
Returns
Object
control to enable/disable auto hide functionality
| Name | Type |
|---|---|
enableAutoHide | Dispatch<SetStateAction<boolean>> |
enableAutoHideConstraintBased | (constraint: boolean) => void |
useCountDown
▸ useCountDown(state, onCountDownFinished?): Object
Parameters
| Name | Type |
|---|---|
state | CountDownState |
onCountDownFinished? | () => void |
Returns
Object
| Name | Type |
|---|---|
cleanup | () => void |
currentCount | number |
startCountDown | () => void |
useEnter
▸ useEnter<T>(fn): Object
Type parameters
| Name | Type |
|---|---|
T | extends Element |
Parameters
| Name | Type |
|---|---|
fn | (e: KeyboardEvent<T>) => void |
Returns
Object
| Name | Type |
|---|---|
onKeyDown | undefined | KeyboardEventHandler<FocusableElement> |
useFullscreenApi
▸ useFullscreenApi(): FullscreenApi
returns a Browser API agnostic access to the Fullscreen API.
See
https://developer.mozilla.org/en-US/docs/Web/API/Fullscreen_API/Guide#prefixing
Returns
FullscreenApi
useHotKey
▸ useHotKey(«destructured»): void
Parameters
| Name | Type |
|---|---|
«destructured» | Object |
› disallowedKeys? | DisallowedKeys |
› handler | () => void |
› isDisabled? | boolean |
› key | string |
Returns
void
useInterval
▸ useInterval(callback, delay?): void
Parameters
| Name | Type |
|---|---|
callback | CallbackFn |
delay? | number |
Returns
void
useIsInWindowBottomHalf
▸ useIsInWindowBottomHalf(): Object
Returns
Object
| Name | Type |
|---|---|
isInBottomHalf | boolean |
update | (el: HTMLElement) => void |
useIsInWindowRightHalf
▸ useIsInWindowRightHalf(): Object
Returns
Object
| Name | Type |
|---|---|
isInRightHalf | boolean |
update | (el: HTMLElement) => void |
useIsMounted
▸ useIsMounted(): () => boolean
From https://usehooks-ts.com/react-hook/use-is-mounted
Deprecated
React recommends to use cancelable promises instead https://reactjs.org/blog/2015/12/16/ismounted-antipattern.html
Returns
fn
▸ (): boolean
Returns
boolean
useMatchMedia
▸ useMatchMedia(mediaQuery): boolean
Parameters
| Name | Type |
|---|---|
mediaQuery | string |
Returns
boolean
useOnClickOutside
▸ useOnClickOutside(fn): RefCallback<HTMLElement>
Hook that only runs callback on click events outside of the referenced element
Parameters
| Name | Type | Description |
|---|---|---|
fn | () => void | the function to be called on click outside |
Returns
RefCallback<HTMLElement>
a ref to the element where we are listening for clicks
usePrevious
▸ usePrevious<T>(value): undefined | T
Type parameters
| Name |
|---|
T |
Parameters
| Name | Type |
|---|---|
value | T |
Returns
undefined | T
useSizeObserver
▸ useSizeObserver(element): Object
Parameters
| Name | Type |
|---|---|
element | HTMLElement |
Returns
Object
| Name | Type |
|---|---|
height | number |
width | number |
useToggleFullscreen
▸ useToggleFullscreen(): () => void
useCallback to toggle browser's fullscreen.
Returns
fn
▸ (): void
Returns
void
useWideContainerObserver
▸ useWideContainerObserver(): Object
Returns
Object
| Name | Type |
|---|---|
containerRef | RefObject<HTMLDivElement> |
isContainerWide | boolean |